<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://ckeditor.com" prefix="ckeditor" %>
<html>
<head>
    <title>文件调查结果显示</title>
    <link rel="stylesheet" href="<c:url value='/resources/styles/main.css' />" type="text/css"/>
</head>
<body>
<table class="header">
    <tr>
        <td>
            <h1>问卷调查结果统计</h1>
        </td>
    </tr>
</table>
<table class="pagination" style="padding-left: 70px;">
    <tr>
        <td>
            <a href="<c:url value='/admin/survey/listQuestionnaire.do'/>">问卷列表</a>
        </td>
    </tr>
</table>
<div style="text-align:center">
    <h3>${question.title}(问卷提交次数：${doSurvey})</h3>

    <table class="list" id="tableObj">

        <tr>
            <th scope="col">序号</th>
            <th scope="col">题目/答案</th>
            <th scope="col">结果显示</th>
        </tr>

        <tbody id="newbody">
        <c:if test="${count>0}">
            <c:forEach var='survey' items="${results}">
                <tr>
                    <td colspan="3" style="background-color: #C2C2C2;"><h4>
                    ${survey.title}
                        <c:if test='${survey.type=="single"}'>(单选)</c:if>
                        <c:if test='${survey.type=="multiple"}'>(多选)</c:if>
                        <c:if test='${survey.type=="ask"}'>(问答)</c:if>
                    </h4></td>
                </tr>
                <c:choose>

                    <c:when test="${survey.type=='ask'}">
                        <c:forEach items="${survey.askInfoList}" var="ask">
                            <tr>
                            <td ></td>
                            <td colspan="2">${ask}</td>
                            </tr>
                        </c:forEach>

                    </c:when>
                    <c:otherwise>
                        <c:forEach items="${survey.answerItems}" var="data">
                            <tr>
                                <td>
                                        ${data.seq}
                                </td>
                                <td>
                                        ${data.title}
                                </td>
                                <td>
                                        ${data.chooseCount}(<fmt:formatNumber value="${data.chooseCount/survey.surveyCount}" type="percent"/>)
                                </td>
                            </tr>
                        </c:forEach>
                        <c:if test="${survey.titleOther!=''}">
                            <tr>
                                <td></td>
                                <td colspan="2">${survey.titleOther}</td>
                                </tr>
                                <c:forEach items="${survey.askInfoList}" var="ask">
                                    <td ></td>
                                    <td colspan="2">${ask}</td>
                                </c:forEach>
                                </tr>
                        </c:if>
                    </c:otherwise>
                </c:choose>

            </c:forEach>
        </c:if>

        </tbody>
    </table>
</div>
</body>
</html>